<?php
/**
 * Created by PhpStorm.
 * User: soulmates
 * Date: 2017/8/15
 * Time: 上午8:13
 */
namespace app\restaurantadmin\controller;
use app\restaurantadmin\model\Room as Rom;
use think\Controller;
class Statistic extends Controller
{
    public function statistic(){
        $uid=session('id');
        $shop= \think\Db::name('dining') ->where('admin_id',$uid)->find();
        $shopid=$shop['shop_id'];

        // $res=\think\Db::name('room')

        //            ->alias('a')
        //            ->join('__ORDER__ b', 'a.order_id =b.order_id')
        //            ->select();
        // Article::hasWhere('comments',['status'=>1])->select();

        //dump($res);die();
        // $res=D("Home/Room")->where($where)->relation(true)->group("")->select();
        //  $rom=new Rom;
        //  $res=$rom::hasWhere('orders',['shopid'=>$shopid])->group("")->select();
        //  dump($res);die();
        //       $food=array();
        //        foreach ($res as $key => $value){
        //          if(!empty($value["order"])){
        //              foreach ($value["order"] as $k => $v){
        //                  $food[$v['food_id']]=$food[$v['food_id']]+$v['num'];
        //              }
        //          }
        //        }
        //  arsort($food);
        //    $data['food_id']=key($food);
        //  $res1=M("Food")->where($data)->find();
        // var_dump($res1);




        return $this->fetch();
    }



}
?>